﻿Imports System
Imports System.Collections.Generic
Imports System.Reflection
Imports System.Workflow.ComponentModel.Design
Imports System.Workflow.ComponentModel.Serialization

Namespace System.Workflow.Activities
    Friend Class StateDesignerLayoutSerializer
        Inherits FreeformActivityDesignerLayoutSerializer
        ' Methods
        Protected Overrides Function GetProperties(ByVal serializationManager As WorkflowMarkupSerializationManager, ByVal obj As Object) As PropertyInfo()
            Dim list As New List([Of] PropertyInfo)
            Dim designer As StateDesigner = [TryCast](obj,StateDesigner)
            If (Not designer Is Nothing) Then
                Dim info As PropertyInfo
                For Each info In MyBase.GetProperties(serializationManager, obj)
                    If (info.Name.Equals("Location", StringComparison.Ordinal) OrElse info.Name.Equals("Size", StringComparison.Ordinal)) Then
                        list.Add(New ExtendedPropertyInfo(info, New GetValueHandler(AddressOf designer.OnGetPropertyValue)))
                    Else
                        list.Add(info)
                    End If
                Next
            Else
                list.AddRange(MyBase.GetProperties(serializationManager, obj))
            End If
            Return list.ToArray
        End Function

    End Class
End Namespace

